const http = require("http");
const querystring = require('querystring'); //查询字符串
http.createServer((req, res) => {
    //req.url  请求路径   req.method 请求方式
    if (req.url == "/" && req.method.toLowerCase() == "post") {
        let alldata = "";
        req.addListener("data", (chunk) => {
            alldata += chunk;
        });
        //全部传输完毕
        req.addListener("end", () => {
            let datastring = alldata.toString();
            let obj = querystring.parse(datastring); //将字符串解析成对象的形式
            res.end("success")
        })
    }
}).listen(80, "127.0.0.1")